define(['app'], function(app) {
	'use strict';

	var controller = function controller($scope, Promotionaddup,$ionicSlideBoxDelegate,$stateParams) {
		$scope.act_id = $stateParams.id;
		$scope.join_num = new Object();
		$scope.prom_nums ={};
		//滑动切换
		$scope.selectTab = 0;
		$scope.activeSlide = function(index) {
			$scope.selectTab = index;
			$ionicSlideBoxDelegate.$getByHandle('tab-handle').slide(index);
		};
	    //滑动切换
		$scope.slideChanged = function(index) {
			$scope.selectTab = index;
		};
		$scope.init_data = function(){
			Promotionaddup.promotion_statistics($scope.act_id,function(data){
				$scope.datas = data;
			})
		}
		$scope.init_data();
		
		/*-------------统计图------------------*/
    var myCharts1 = echarts.init(document.getElementById('pic1'));
    var option1 = {
        backgroundColor: '#fdfddd',//大背景颜色
        title: {//标题
            text: '课程内容分布',
            left: 'center',
            top: 20,
            textStyle: {
                color: '#f60'
            }
        },
        tooltip : {//鼠标放在饼图上，显示该饼图对应的数据，app上可以不需要该功能
            trigger: 'item',
            formatter: "{b} : {d}%"
        },

        visualMap: {//饼图旁边的游标图
            show: false,//是否显示游标
            min:1,
            max:100,
            inRange: {
                colorLightness: [0.5, 1]//控制游标颜色
            }
        },
        series : [
            {
                //name:'课程内容分布',
                type:'pie',//统计图的形状
                clockwise:'true',
               // startAngle:'40',//控制饼图的角度
                radius : '70%',//饼图占整个大背景百分之几
                center: ['60%', '50%'],//圆心到整个大背景的左、顶的距离，一般都为50%
                data:[
                    {
                        value:70,
                        name:'语言',
                        itemStyle:{
                            normal:{
                                color:'green',//字体颜色，对应的饼图和字体颜色相同
//                              shadowBlur:'60',//以下3个参数控制阴影--一般不需要
//                              shadowColor:'rgba(0,0,0,0.8)',
//                              shadowOffsetY:'10'
                            }
                        }
                    },
                    {
                        value:10,
                        name:'美国科学&社会科学',
                        itemStyle:{
                            normal:{
                                color:'rgb(1,175,80)'
                            }
                        }
                    },
                    {
                        value:20,
                        name:'美国数学',
                        itemStyle:{
                            normal:{
                                color:'#f60',
                            }
                        }
                    }

                ],
            }
        ]
    };
    myCharts1.setOption(option1);
		
		
	}

	controller.$inject = ['$scope', 'Promotionaddup','$ionicSlideBoxDelegate','$stateParams'];
	
	return app.registerController("promotionaddupctrl",controller);
});


